<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
<script>
// Promise静态方法

// Promise.resolve()默认返回一个成功状态的Promsie对象
// Promise.reject()返回一个失败状态的Promsie对象

let p1 = Promise.resolve(123);
let p2 = Promise.reject(456);

p1.then(
    (res)=>{
        console.log( 'p1成功',res );
    },
    (res)=>{
        console.log( 'p1失败',res );
    }
);

p2.then(
    (res)=>{
        console.log( 'p2成功',res );
    },
    (res)=>{
        console.log( 'p2失败',res );
    }
);

// 当Promise.resolve传入一个Promise对象时，返回的Promise对象跟随传入的Promise对象
let p3 = Promise.resolve(p2);
p3.then(
    (res)=>{
        console.log( 'p3成功',res );
    },
    (res)=>{
        console.log( 'p3失败',res );
    }
);

</script>
</body>
</html>